package com.swak.paxos;

import com.swak.exception.RemotingException;
import com.swak.paxos.impl.PaxosNode;
import com.swak.reactivex.transport.ExchangeHandler;

/**
 * Paxos.
 * 
 * @author 618lf
 */
public class Paxos {

	/**
	 * 运行 Paxos 协议.
	 * 
	 * @param config 配置
	 * @return 返回 PaxosNode
	 * @throws RemotingException
	 */
	public static Node runPaxos(PaxosConfig config) throws RemotingException {
		return new PaxosNode(config);
	}

	/**
	 * 运行 Paxos 协议.
	 * 
	 * @param config 配置
	 * @param handler 处理器
	 * @return 返回 PaxosNode
	 * @throws RemotingException
	 */
	public static Node runPaxos(PaxosConfig config, ExchangeHandler handler) throws RemotingException {
		return new PaxosNode(config, handler);
	}
}